package cn.telling.tianlianproduct.controls.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import cn.telling.common.vo.PageReturnVo;
import cn.telling.common.vo.PageVo;
import cn.telling.tianlianproduct.controls.dao.PictureLogoMapper;
import cn.telling.tianlianproduct.controls.service.IPictureLogo;
import cn.telling.tianlianproduct.controls.vo.PictureLogoVo;
import cn.telling.utils.StringHelperTools;

/**
 * 
 * @ClassName: PictureLogoImpl 
 * @Description: 查找标签的业务接口实现
 * @author 陈赟 
 * @date 2015年9月7日 下午3:02:20 
 *
 */
@Service("pictureLogoControlService")
public class PictureLogoImpl implements IPictureLogo {
    
    @Autowired
    @Qualifier("pictureLogoMapper")
    private PictureLogoMapper pictureLogoMapper;

    @Override
    public PageReturnVo<PictureLogoVo> getPictureLogoListByKeyword(String keyword, PageVo pageVo) {
        if(!StringHelperTools.isEmpty(keyword)) {
            keyword = keyword.replaceAll("\\s*", "").toLowerCase();
        }
        
        PageReturnVo<PictureLogoVo> pageReturnVo = new PageReturnVo<PictureLogoVo>();
        List<PictureLogoVo> pictureLogoList = pictureLogoMapper.findPictureLogoListByKeyword(keyword, pageVo);
        int size = pictureLogoMapper.findPictureLogoListSizeByKeyword(keyword);
        pageReturnVo.setResultList(pictureLogoList);
        pageReturnVo.setTotalCount(size);
        
        return pageReturnVo;
    }

}
